#define  _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>

struct Stu
{
	char name[20];
	int age;
};

int sort_by_name(void* p1, void* p2)
{
	return strcmp(((struct Stu*)p1)->name, ((struct Stu*)p1)->name);
}

int sort_by_age(void* p1, void* p2)
{
	return ((struct Stu*)p1)->age - ((struct Stu*)p2)->age;
}
int main()
{
	struct Stu s[3] = { {"zhangsan",20},{"lisi",25},{"wangwu",15} };
	//qsort(s, 3, sizeof(struct Stu), sort_by_name);
	qsort(s, 3, sizeof(struct Stu), sort_by_age);
	return 0;
}